﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Database;

namespace Business
{
    public class BaseBO
    {
        private static DBPonto database;

        private static void CarregarDatabase()
        {
            database = new DBPonto();
            database.ReadXml("database.xml");
        }
        
        internal static DBPonto Database
        {
            get
            {
                if (database == null)
                    CarregarDatabase();

                return database;
            }
        }

        internal static DBPonto.LancamentoDataTable TBLancamento
        {
            get
            {
                return Database.Tables["Lancamento"] as DBPonto.LancamentoDataTable;
            }
        }

        internal static DBPonto.FeriadoDataTable TBFeriado
        {
            get
            {
                return Database.Tables["Feriado"] as DBPonto.FeriadoDataTable;
            }
        }

        internal static void Salvar()
        {
            Database.WriteXml("database.xml");
            database = null;
        }
    }
}
